program horsejump;

var qi:array[1..20,1..20] of shortint;
    m,n:integer;
    x1,y1,x2,y2,total:integer;

procedure input;
  var f:text;
  begin
    assign(f,'d:\tq\input.txt');
    reset(f);
    readln(f,m,n);
    readln(f,x1,y1);
    readln(f,x2,y2);
    close(f);
  end;

procedure output;

 begin
   writeln;
   writeln('The total is : ',total);
 end;

function pan(a1,b1:integer):boolean;
 var k:boolean;
 begin
   k:=false;
   if (a1<=m)and(b1<=n)and(a1>0)and(b1>0) then k:=true;
   pan:=k;
 end;


procedure di(a,b:integer);

 begin
   if (a=x2)and(b=y2) then inc(total)
                      else
        begin

             if pan(a,b) then
                begin
                   di(a+1,b+2);
                   di(a+1,b-2);
                   di(a+2,b+1);
                   di(a+2,b-1);

                end;
        end;
 end;



begin
  input;
  total:=0;
  di(x1,y1);
  output;
end.
















